#!/usr/bin/python

"""
Works in conjunction with fm.py
"""

import os
import wx
import debug

def stage1():
	app = wx.PySimpleApp()
	app.SetAppName('farmhand')
	return app
	
def stage2_setup_configuration_dir():
	import fm,configuration,paths

	fm.configuration_dir = paths.get_configuration_dir()
	
	if not os.path.exists(fm.configuration_dir):
		os.makedirs(fm.configuration_dir)
	
	if not os.path.exists(fm.get_user_settings_module_path()):
		configuration.make_initial_user_settings_file()
		
		
def stage3():
	import fm,mainframe
	
	main_frame = mainframe.MainFrame()
	fm.main_frame=main_frame # ?? HACK! (doc needs this) I'm a bad man.
	
	main_frame.Show()
	
	return main_frame, main_frame.main_panel
	
def stage4_main_loop():
	import fm
	fm.reset_status_text()
	fm.app.MainLoop()
